# TypeScript

Languine supports TypeScript localization files with full type safety. This format extends JavaScript support with additional TypeScript-specific features and type generation capabilities.

---

## Setting Up

First, make sure you've got a languine.json config file in your project root. Here's an example:

```json
{
  "locale": {
    "source": "en",
    "targets": ["sv", "de", "fr"]
  },
  "files": {
    "ts": {
      "include": ["src/locales/[locale].ts"]
    }
  }
}
```

## Translating

With your config set, run:

```bash
npx languine@latest translate
```

When you run this command, Languine will:

- Load your source TypeScript files (e.g., src/locales/en.ts)
- Detect any new or modified translation strings
- Generate translations for your target languages
- Create or update the target language files (e.g., src/locales/sv.ts)
- Preserve type annotations and interfaces
- Handle nested objects with proper typing
- Maintain code formatting and documentation comments
- Support literal types and union types
